home *** CD-ROM | disk | FTP | other *** search
- 1 'save "BERSERK.BAS",a ' berserk game like meteor
- 2 DEFINT A-Z:KEY OFF:CLS:LOCATE ,,0
- 3 DIM CRASHER(10,5),BULLET(10,4),BERSERKER$(12),BFREE(11),SCORES(11),SCORES$(11)
- 4 PRINT "BERSERK! by Keith P. Graham":print "Do you need Instructions";
- 5 Y$=""
- 6 WHILE Y$<> "Y" AND Y$ <> "y" AND Y$<> "N" AND Y$<> "n"
- 7 INPUT Y$
- 8 WEND
- 9 IF Y$="N" OR Y$="n" GOTO 400
- 10 CLS
- 11 PRINT "The year is 2086 and you are a private in the Astro-Marines."
- 12 PRINT "Your assignment is to observe sector 273.425 for Berserker"
- 13 PRINT "activity. The Berserkers, a race of machines who want to destroy"
- 14 PRINT "humanity, have been releasing gravity bombs towards the Earth."
- 15 PRINT "These bombs are really huge asteroids which when aimed at earth"
- 16 PRINT "fall slowly towards the planet until striking it and breaking"
- 17 PRINT "the earth into a thousand pieces. The bombs are accompanied"
- 18 PRINT "by a terrible meteorite storm."
- 20 PRINT "You must watch for meteors and gravity bombs. If you see them"
- 21 PRINT "you may press the firing button (space bar) and shoot at them."
- 22 PRINT "Meteors appear as rapidly falling arrows on your screen. If you"
- 23 PRINT "hit a meteor you will receive 25 merit points. If you miss the"
- 24 PRINT "meteor will hit the earth and kill thousands of people, but since"
- 25 PRINT "usually happens in other parts of the world, you only loose one"
- 26 PRINT "merit for every time a meteor gets by."
- 27 PRINT "If a meteor crashes into you, you loose 50 points."
- 28 PRINT "When you see the Berserker bomb appear you must try to"
- 30 PRINT "destroy it. It will keep coming until every trace of it"
- 31 PRINT "is vapourized by your missiles. If you can do this, you"
- 32 PRINT "can win the game."
- 34 PRINT "From time to time you may see a berserker observer boat go"
- 35 PRINT "by. If you can hit one of those its worth 200 points."
- 36 PRINT " "
- 37 PRINT "Press return to continue";
- 38 INPUT A$
- 39 CLS
- 400 REM constants
- 401 RANDOMIZE TIMER
- 402 CLS
- 403 CRASHES=0
- 404 SCORE=0
- 405 BTIME = 35
- 406 CRASHMAX=3
- 407 BMAX=7
- 408 CTKEY=0
- 409 KEYGO$=CHR$(77)+CHR$(75)+CHR$(80)+CHR$(72)+CHR$(27)+CHR$(32)
- 410 CTKEYX=0
- 413 C$=CHR$(25)
- 414 B$=CHR$(24)
- 415 ME$=CHR$(178)
- 416 MEY=40:MEX=24
- 417 BERMAX=10:BINDEX = 1
- 418 BSIZE=10
- 420 'print "LN";v$;"VF";
- 421 LOCATE MEX,MEY :PRINT ME$;
- 423 FOR M = 1 TO CRASHMAX
- 424 GOSUB 30000 ' create crasher M
- 425 NEXT M
- 426 GOSUB 35000 ' create the berserker
- 427 GOSUB 38000 ' create a patrol boat
- 428 REM loop for game
- 429 X= 0
- 430 WHILE X= 0
- 431 GOSUB 10000 ' get a key
- 432 FOR M = 1 TO CRASHMAX
- 433 GOSUB 20000 ' crasher
- 434 NEXT M
- 435 FOR B=1 TO BMAX
- 436 GOSUB 55000
- 437 NEXT B
- 438 GOSUB 25000 'check the berserker
- 439 GOSUB 15000 'check the boat
- 440 WEND
- 441 GOTO 60000
- 10000 REM this routine gets a key and checks to see if its correct
- 10001 CTKEY$=INKEY$:IF CTKEY$="" THEN RETURN
- 10002 WHILE CTKEY$<>""
- 10003 CTKEY=ASC(RIGHT$(CTKEY$,1))
- 10004 CTKEY$=INKEY$
- 10005 WEND
- 10006 GT = INSTR(KEYGO$,CHR$(CTKEY))
- 10007 IF GT=0 THEN RETURN
- 10008 ON GT GOTO 10100,10200,10300,10400,60000,50000,10009
- 10009 RETURN
- 10100 REM right key pressed
- 10101 LOCATE MEX,MEY :PRINT " "; ' space out the old one
- 10102 MEY=MEY+1
- 10103 IF MEY > 77 THEN MEY=77
- 10104 GOTO 10500
- 10200 REM left key pressed
- 10201 LOCATE MEX,MEY:PRINT" "; ' space out the old one
- 10202 MEY=MEY-1
- 10203 IF MEY <1 THEN MEY = 1
- 10204 GOTO 10500
- 10300 REM down key pressed
- 10301 LOCATE MEX,MEY:PRINT " "; ' space out the old one
- 10302 MEX=MEX+1
- 10303 IF MEX > 24 THEN MEX=24
- 10304 GOTO 10500
- 10400 REM up key pressed
- 10401 LOCATE MEX,MEY:PRINT " "; ' space out the old one
- 10402 MEX=MEX-1
- 10403 IF MEX < 1 THEN MEX=1
- 10404 GOTO 10500
- 10500 REM print the me$
- 10501 LOCATE MEX,MEY:PRINT ME$;
- 10502 GOSUB 40000 ' check for hit
- 10503 GOTO 45000 ' check for eat
- 15000 REM check for boat
- 15001 IF BOATY=0 THEN RETURN
- 15002 LOCATE BOATX,BOATY:PRINT " ";
- 15003 BOATY=BOATY+1
- 15004 IF BOATY > 77 THEN BOATY = 0:RETURN
- 15005 LOCATE BOATX,BOATY:PRINT CHR$(&HA4);
- 15006 RETURN
- 15007 RETURN
- 20000 REM move the crasher
- 20001 ' m has the crasher
- 20002 LOCATE CRASHER(M,1),CRASHER(M,2):PRINT " ";
- 20003 CRASHER(M,1)=CRASHER(M,1)+CRASHER(M,3)
- 20004 IF CRASHER(M,1)>23 THEN GOSUB 30000:SCORE=SCORE - 1:RETURN
- 20005 CRASHER(M,2)=CRASHER(M,2)+CRASHER(M,4)
- 20006 IF CRASHER(M,2)>77 THEN CRASHER(M,2)=1
- 20007 IF CRASHER(M,2)<1 THEN CRASHER(M,2)=77
- 20008 LOCATE CRASHER(M,1),CRASHER(M,2):PRINT C$;
- 20009 M1=M
- 20010 GOTO 40050
- 25000 REM move the berserker
- 25001 ON PHASE GOTO 25100,26000,25100,27000,25100
- 25100 BCOUNT = BCOUNT+1
- 25101 IF BCOUNT > BTIME THEN PHASE = PHASE + 1:BCOUNT = 0
- 25102 RETURN
- 26000 REM move the beserker down a line
- 26001 PHASE = 1
- 26002 BLINE=BLINE+1 ' bline is the bottom line of ther berserker
- 26003 ELINE=BLINE-BSIZE ' eline is the top line of the beserker
- 26005 BP = BERMAX+1-BSIZE ' first line of berserker
- 26006 IF BLINE <1 GOTO 26010
- 26007 IF BERSERKER$(BP)<>SPACE$(LEN(BERSERKER$(BP))) GOTO 26010
- 26008 BSIZE= BSIZE - 1 :BLINE=BLINE-1
- 26009 IF BSIZE < 1 THEN GOTO 27000
- 26010 REM
- 26011 REM print each of the lines of the beserker
- 26012 IF BLINE=24 GOTO 60000
- 26013 IF ELINE<1 THEN ELINE=1
- 26014 IF ELINE<>1 AND BOATY=0 THEN BOATY = 1
- 26015 ' print "AA";
- 26016 IF ELINE<>0 THEN LOCATE ELINE,1:PRINT SPACE$(77);
- 26017 FOR B=ELINE TO BLINE
- 26018 ' calculate bottom line
- 26019 BINDEX= (BLINE-B)+1+(BERMAX-BSIZE)
- 26020 IF B=24 AND BERSERKER$(BINDEX-1)<>SPACE$(42) GOTO 60000
- 26021 IF B < 25 THEN LOCATE B,20:PRINT BERSERKER$(BINDEX);
- 26022 NEXT B
- 26023 REM check to see if we have been eaten by a beserker
- 26024 GOTO 45000
- 27000 'end game
- 27001 PRINT "LF";V$;"VN";
- 27002 CLS
- 27003 PRINT " I hate to say this, but you may have won this game"
- 27004 GOSUB 59000
- 27005 LOCATE 2,7
- 27006 PRINT "Enter you initials (3 characters) ";
- 27007 INTI$=""
- 27008 INPUT INIT$
- 27009 PRINT
- 27010 OPEN "A",1,"bscores"
- 27011 WRITE #1," ",-9999
- 27012 CLOSE #1
- 27013 OPEN "I",1,"bscores"
- 27014 FOR J = 1 TO 10
- 27015 IF NOT EOF(1) THEN INPUT #1,SCORES$(J)
- 27016 IF NOT EOF(1) THEN INPUT #1,SCORES(J)
- 27017 NEXT J
- 27018 CLOSE #1
- 27019 OPEN "O",1,"bscores"
- 27020 FOR J = 1 TO 10
- 27021 IF SCORES(J) < SCORE THEN SCORES(J)=SCORE:SCORES$(J)=INIT$:GOTO 27900
- 27022 NEXT J
- 27900 FOR J = 1 TO 10
- 27901 WRITE #1,SCORES$(J),SCORES(J)
- 27902 PRINT SCORES$(J),SCORES(J)
- 27903 NEXT J
- 27904 CLOSE #1
- 27906 GOTO 60010
- 27907 RETURN
- 30000 REM create a crasher
- 30001 ' m has the crasher number
- 30002 ' the crashers always start on row past the beserker
- 30003 IF BLINE<24 THEN CRASHER(M,1)=BLINE+1 ELSE CRASHER(M,1)=24
- 30004 ' they can start on any column from 1 to 77
- 30005 CRASHER(M,2)=INT(RND*77)+1
- 30006 ' they can have a horizontal speed from -4 to +4
- 30007 CRASHER(M,4)=4 - INT(RND*9)
- 30008 ' they can have a verticle speed from 1 to 3
- 30009 CRASHER(M,3)=INT(RND*2)+1
- 30010 ' they can have an attribute of A to P (65 to 79) (but not blink or UL)
- 30011 CRASHER(M,5)=65+INT(RND*2)+4*INT(RND*2)
- 30012 RETURN
- 35000 REM init berseker
- 35001 ' bottom lline of berserker is berserker$(1)
- 35002 FOR B=1 TO BSIZE
- 35003 BERSERKER$(B)= STRING$((11-B)*2,32)+STRING$((4*B)-2,176)+STRING$((11-B)*2,32)
- 35004 NEXT B
- 35005 BLINE=1
- 35006 PHASE = 1
- 35007 RETURN
- 38000 REM create boat
- 38001 BOATY=0
- 38002 BOATX=1
- 38003 RETURN
- 40000 REM check to see if the thing is hit
- 40001 FOR M1 = 1 TO CRASHMAX
- 40002 GOSUB 40050
- 40003 NEXT M1
- 40004 RETURN
- 40050 IF ((MEX<(CRASHER(M1,1)-1)) OR (MEX>(CRASHER(M1,1)+1))) THEN RETURN
- 40051 IF ((MEY<(CRASHER(M1,2)-1)) OR (MEY>(CRASHER(M1,2)+1))) THEN RETURN
- 40052 REM the crash
- 40053 CRASHES=CRASHES+1
- 40054 SCORE= SCORE - 50
- 40055 GOSUB 59000
- 40056 LOCATE CRASHER(M1,1),CRASHER(M1,2):PRINT " ";
- 40057 LOCATE MEX,MEY:PRINT ME$;
- 40058 M=M1
- 40059 GOTO 30000
- 45000 REM beserker check
- 45005 ' LOCATE 25,40:PRINT BLINE;MEY;MEX;
- 45011 IF MEX>BLINE THEN GOTO 45070 'bline is bottom of beserker
- 45012 IF MEY<20 THEN GOTO 45070 ' left and
- 45013 IF MEY>60 THEN GOTO 45070 'right of berserker
- 45014 ' bsize starts out at 10 and is the size of the berserker
- 45015 ' number of lines first index of berserker - 1
- 45016 BINDEX= (BLINE-MEX) +1+ (BERMAX-BSIZE)
- 45017 'IF BINDEX>BMAX GOTO 45070
- 45018 BX=MEY-19
- 45019 IF MID$(BERSERKER$(BINDEX),BX,1)=" " THEN GOTO 45070
- 45020 REM we have been eaten by a beserker
- 45021 GOTO 60000
- 45070 RETURN
- 50000 REM shoot up
- 50001 REM find a free bullet
- 50002 IF MEX=0 THEN RETURN
- 50003 FOR B= 1 TO BMAX
- 50004 IF BFREE(B)= 0 THEN GOTO 50100
- 50005 NEXT B
- 50006 RETURN
- 50100 BFREE(B)=1
- 50101 BULLET(B,2)=MEY
- 50102 BULLET(B,1)=MEX-1
- 50103 LOCATE BULLET(B,1),BULLET(B,2):PRINT B$;
- 50104 RETURN
- 55000 REM move bullets
- 55001 IF BFREE(B)=0 THEN RETURN
- 55002 LOCATE BULLET(B,1),BULLET(B,2):PRINT " ";
- 55003 BULLET(B,1)=BULLET(B,1)-1
- 55004 IF BULLET(B,1)<1 THEN BFREE(B)=0:RETURN
- 55006 LOCATE BULLET(B,1),BULLET(B,2):PRINT B$;
- 55007 GOTO 56000
- 56000 FOR M1 = 1 TO CRASHMAX
- 56001 IF BULLET(B,1)<CRASHER(M1,1)-1 OR BULLET(B,1)>CRASHER(M1,1)+1 THEN GOTO 56050
- 56002 IF BULLET(B,2)<CRASHER(M1,2)-1 OR BULLET(B,2)>CRASHER(M1,2)+1 THEN GOTO 56050
- 56003 GOTO 56100
- 56050 REM check to see if we hit the boat
- 56051 IF BOATY=0 GOTO 56060
- 56052 IF BULLET(B,1)>2 THEN GOTO 56060
- 56053 IF BULLET(B,2)<BOATY-1 OR BULLET(B,2)>BOATY+1 GOTO 56060
- 56054 REM hit the boat!!!!
- 56055 SCORE=SCORE + 200
- 56056 LOCATE BOATX,BOATY:PRINT " ";
- 56057 BOATY=0
- 56058 GOTO 59000
- 56060 REM check to see if we are hitting beserker
- 56061 IF BULLET(B,1)>BLINE THEN GOTO 56080 'bline is bottom of beserker
- 56062 IF BULLET(B,2)<20 THEN GOTO 56080 ' left and
- 56063 IF BULLET(B,2)>60 THEN GOTO 56080 'right of berserker
- 56064 BINDEX= (BLINE-BULLET(B,1))+1+(BERMAX-BSIZE)
- 56065 IF BINDEX>BERMAX GOTO 56080
- 56066 BX=BULLET(B,2)-19
- 56067 IF MID$(BERSERKER$(BINDEX),BX,1)=" " THEN GOTO 56080
- 56068 SCORE= SCORE +5
- 56069 BFREE(B)=0
- 56070 LOCATE CRASHER(M1,1),CRASHER(M1,2):PRINT " ";
- 56071 MID$(BERSERKER$(BINDEX),BX,1)=" "
- 56072 GOTO 59000
- 56080 NEXT M1
- 56081 RETURN
- 56100 REM hit a crasher, destroy bullet and crasher
- 56101 LOCATE CRASHER(M1,1),CRASHER(M1,2):PRINT " ";
- 56102 LOCATE BULLET(B,1),BULLET(B,2):PRINT "*";
- 56103 SCORE=SCORE+25
- 56104 GOSUB 59000
- 56105 BFREE(B)=0
- 56106 M=M1
- 56107 GOSUB 30000
- 56108 GOTO 56080
- 59000 REM print score
- 59001 LOCATE 25,2 :PRINT "score =";SCORE;
- 59002 LOCATE 25,30 :PRINT "CRASHES=";CRASHES;
- 59003 RETURN
- 60000 REM end of program, time to tally score
- 60001 'print "LF";v$;"VN";
- 60002 CLS:PRINT "You loose, fool."
- 60003 PRINT "The beserker bomb has struck, the earth is destroyed"
- 60004 GOSUB 59000
- 60010 REM wait for key
- 60011 FOR J = 1 TO 5000
- 60012 NEXT J
- 60013 Y$=""
- 60014 PRINT "Play again? (Y/N)";
- 60015 WHILE Y$<>"Y" AND Y$<>"N"
- 60016 Y$=INKEY$
- 60017 IF Y$="y" THEN Y$="Y"
- 60018 IF Y$="n" THEN Y$="N"
- 60019 WEND
- 60020 CLS
- 60021 IF Y$="Y" GOTO 400